function s = NonDiagonalElementsSum( A )
N = size(A, 1);
s = 0;
for i = 1 : N
    for j = 1 : N
        if (i ~= j)
            s = s + A(i, j)^2;
        end;
    end; 
end;
end

